Skip to content

rp2040/rp2350: Support multicast TTL socket option - #11174

Merged
tannewt merged 2 commits into
adafruit:mainfrom
Daniiiil1:fix/rp2-multicast-ttl
Aug 6, 2026
Merged

rp2040/rp2350: Support multicast TTL socket option#11174
tannewt merged 2 commits into
adafruit:mainfrom
Daniiiil1:fix/rp2-multicast-ttl

Conversation

@Daniiiil1

Copy link
Copy Markdown

Closes #9938.

The Raspberry Pi port uses lwIP's raw API rather than its socket API, so it cannot delegate this option to lwip_setsockopt() as the Espressif port does. Handle IPPROTO_IP / IP_MULTICAST_TTL for UDP sockets by updating the UDP PCB's multicast TTL directly.

The implementation also:

  • returns EOPNOTSUPP for non-datagram sockets;
  • returns EINVAL for a closed UDP PCB or an empty option value;
  • follows lwIP's one-byte IP_MULTICAST_TTL representation.

Testing:

  • pre-commit run --files ports/raspberrypi/common-hal/socketpool/Socket.c
  • gmake -C ports/raspberrypi BOARD=raspberry_pi_pico_w -j4
  • gmake -C ports/raspberrypi BOARD=raspberry_pi_pico2_w -j4
  • inspected both generated objects to confirm the option path writes one byte to udp_pcb.mcast_ttl

Both builds produced firmware.uf2. I do not have a Pico W/Pico 2 W connected, so I have not performed an on-device multicast packet capture.

@tannewt

tannewt commented Aug 4, 2026

Copy link
Copy Markdown
Member

@todbot want to test this? The issue from jepler says it is needed for your MicroOSC.

@todbot

todbot commented Aug 5, 2026

Copy link
Copy Markdown

@todbot want to test this? The issue from jepler says it is needed for your MicroOSC.

Yep, verified this change lets MicroOSC receive & send Multicast UDP OSC messages on RP2040 Pico W. Thanks!

@Daniiiil1
Daniiiil1 marked this pull request as ready for review August 6, 2026 15:20

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much @Daniiiil1

@tannewt
tannewt merged commit 869d51b into adafruit:main Aug 6, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rp2040/rp2350: support setsockopt(IPPROTO_IP, IP_MULTICAST_TTL, ttl)

3 participants